package com.uwo.commons.configuration.aop.validate.excepteion;


import com.uwo.commons.configuration.aop.validate.ErrorCode;

/**
 * api验证异常
 * @author hao.yan
 */
public class ApiValidateExceptrion extends RuntimeException {

    public ApiValidateExceptrion(Throwable throwable) {
        super(throwable);
    }

    public ApiValidateExceptrion(ErrorCode errorCode){
        this(errorCode.getCode(), errorCode.getMessage());
    }

    public ApiValidateExceptrion(int code, String msg){
        super(msg);
        this.code = code;
    }

    private int code;

    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return super.getMessage();
    }

    /**
     * 重写fillInStackTrace可以降低性能消耗
     * 去掉同步synchronized
     * 不需要实现堆栈信息
     * @return
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

}
